package com.wnxy.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wnxy.admin.dto.JChargingCardDto;
import com.wnxy.admin.dto.JSharingManagementDto;
import com.wnxy.admin.entity.SharingManagement;
import com.wnxy.admin.mapper.SharingManagementMapper;
import com.wnxy.admin.service.ISharingManagementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * <p>
 * 共享管理表 服务实现类
 * </p>
 *
 * @author All
 * @since 2023-11-29
 */
@Service
public class SharingManagementServiceImpl extends ServiceImpl<SharingManagementMapper, SharingManagement> implements ISharingManagementService {

    private final SharingManagementMapper sharingManagementMapper;
    public SharingManagementServiceImpl(SharingManagementMapper sharingManagementMapper){
        this.sharingManagementMapper = sharingManagementMapper;
    }

    @Override
    public PageInfo<JSharingManagementDto> findByPage(String chargingPileName, int pageNum, int pageSize) {
        //1.设置页码和每页大小
        PageHelper.startPage(pageNum, pageSize);
        //2.调用DAO层查询
        List<JSharingManagementDto> list = sharingManagementMapper.findAll(chargingPileName);
        //3.返回PageInfo对象
        return new PageInfo<>(list);
    }
}
